/*************************************************************
MYD Engine - v0.1

file: myd_tilemap.cpp
creation date: 04/08/09
*************************************************************/
#include "myd_tilemap.h"
#include "graphics/myd_renderer.h"
#include "graphics/myd_texture.h"

using namespace myd;

void Tilemap::draw(Renderer *tm_renderer)
{
/*	for (int i=0;i<tilesVector.size();i++){
		tilesVector[i]->draw(*tm_renderer);
	}*/
}

void Tilemap::trueDraw(Renderer *tm_renderer)
{
	assert(wn_texture);
	
	// set the world matrix
	tm_renderer->setMatrixMode(WORLD);

	// reset the matrix
	//tm_renderer->loadIdentity();<--DONT

	//Entity2d::draw(*tm_renderer);

	// apply transformation
	tm_renderer->translate(startingX, startingY);
	
	if(tm_renderer->bindTexture(*wn_texture))
		tm_renderer->draw(wn_vertices, Renderer::TRIANGLE_STRIP, 4);
	else
		assert(0);
}

void Tilemap::SetPos(int x, int y)
{
	startingX = x;
	startingY = y;
	
	/*for(int i=0;i<tilesPerHeight;i++)
	{
		tilesVector[i]->setPos(startingX, startingY, -1);
		startingX ++;//= tilesVector[0]->getWidth();
		//startingY -= tilesVector[i]->getHeight();
	}*/
}

Tilemap::Tilemap(void)
{
}
